/**
 * 主题配置文件
 * 统一管理应用的视觉设计令牌(Design Tokens)
 */

// Ant Design 主题配置
export const antdTheme = {
  token: {
    // 主色调
    colorPrimary: '#1890ff',
    colorSuccess: '#52c41a',
    colorWarning: '#faad14',
    colorError: '#ff4d4f',
    colorInfo: '#1890ff',

    // 文本颜色
    colorText: 'rgba(0, 0, 0, 0.88)',
    colorTextSecondary: 'rgba(0, 0, 0, 0.65)',
    colorTextTertiary: 'rgba(0, 0, 0, 0.45)',
    colorTextQuaternary: 'rgba(0, 0, 0, 0.25)',

    // 边框
    colorBorder: '#d9d9d9',
    colorBorderSecondary: '#f0f0f0',
    borderRadius: 6,

    // 背景色
    colorBgContainer: '#ffffff',
    colorBgLayout: '#f5f5f5',
    colorBgElevated: '#ffffff',

    // 字体
    fontSize: 14,
    fontSizeHeading1: 38,
    fontSizeHeading2: 30,
    fontSizeHeading3: 24,
    fontSizeHeading4: 20,
    fontSizeHeading5: 16,
    fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif",

    // 间距
    padding: 16,
    paddingLG: 24,
    paddingSM: 12,
    paddingXS: 8,
    margin: 16,
    marginLG: 24,
    marginSM: 12,
    marginXS: 8,

    // 阴影
    boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
    boxShadowSecondary: '0 1px 2px rgba(0, 0, 0, 0.06)',

    // 动画
    motionDurationSlow: '0.3s',
    motionDurationMid: '0.2s',
    motionDurationFast: '0.1s',
  },
  components: {
    // 布局组件
    Layout: {
      headerBg: '#001529',
      siderBg: '#001529',
      bodyBg: '#f0f2f5',
      headerHeight: 64,
      headerPadding: '0 24px',
    },
    // 菜单组件
    Menu: {
      darkItemBg: '#001529',
      darkSubMenuItemBg: '#000c17',
      darkItemSelectedBg: '#1890ff',
      itemSelectedColor: '#1890ff',
    },
    // 按钮组件
    Button: {
      controlHeight: 32,
      controlHeightLG: 40,
      controlHeightSM: 24,
    },
    // 卡片组件
    Card: {
      borderRadiusLG: 8,
      boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
    },
    // 表单组件
    Form: {
      labelFontSize: 14,
      labelColor: 'rgba(0, 0, 0, 0.88)',
      itemMarginBottom: 24,
    },
    // 输入框组件
    Input: {
      controlHeight: 32,
      borderRadius: 6,
    },
  },
};

// 自定义设计令牌
export const customTokens = {
  // 布局尺寸
  layout: {
    siderWidth: 256,
    siderCollapsedWidth: 80,
    headerHeight: 64,
    contentPadding: 24,
    contentMargin: 16,
  },

  // 视频相关
  video: {
    controlBg: 'rgba(0, 0, 0, 0.5)',
    controlBgHover: 'rgba(0, 0, 0, 0.7)',
    overlayZIndex: 10,
    boundingBoxZIndex: 5,
  },

  // 智能框颜色配置
  boundingBox: {
    person: {
      border: '#00ff00',
      background: 'rgba(0, 255, 0, 0.8)',
      text: '#000000',
    },
    car: {
      border: '#ff0000',
      background: 'rgba(255, 0, 0, 0.8)',
      text: '#ffffff',
    },
    bicycle: {
      border: '#0000ff',
      background: 'rgba(0, 0, 255, 0.8)',
      text: '#ffffff',
    },
    default: {
      border: '#00ff00',
      background: 'rgba(0, 255, 0, 0.8)',
      text: '#000000',
    },
  },

  // 状态颜色
  status: {
    online: '#52c41a',
    offline: '#d9d9d9',
    error: '#ff4d4f',
    warning: '#faad14',
    processing: '#1890ff',
  },

  // Z-index 层级管理
  zIndex: {
    dropdown: 1050,
    modal: 1000,
    notification: 1010,
    message: 1010,
    popover: 1030,
    tooltip: 1060,
    fullscreen: 9999,
  },
};

// 导出合并后的主题配置
export const theme = {
  ...antdTheme,
  custom: customTokens,
};

export default theme;
